class Solution {
public:
    int climbStairs(int n) {
        if (n == 1) {
            return 1;
        }
        else if (n == 2) {
            return 2;
        }
        int a = 1, b = 2, tmp = 0, index = 2;
        while (index < n) {
            tmp = a;
            a = b;
            b += tmp;
            index++;
        }
        return b;
    }
};